Skip to content

Comments

feat: add missing OpenAI/Claude/Gemini request fields#2971

Open
seefs001 wants to merge 4 commits intoQuantumNous:mainfrom
seefs001:fix/missing-request-field
Open

feat: add missing OpenAI/Claude/Gemini request fields#2971
seefs001 wants to merge 4 commits intoQuantumNous:mainfrom
seefs001:fix/missing-request-field

Conversation

@seefs001
Copy link
Collaborator

@seefs001 seefs001 commented Feb 19, 2026

Summary by CodeRabbit

  • New Features

    • Channel-level toggles: "Allow include obfuscation" (OpenAI) and "Allow inference geo" (Claude).
    • New request options exposed: function-call payload, service tier, conversation/context, safety identifier, and nullable log-probs.
    • Admin UI: new "Subscriptions" module.
  • Improvements

    • Streaming/response handling respects channel obfuscation and passthrough settings.
    • Gemini config gains an enhanced civic answers flag.
  • Tests

    • Added tests validating passthrough skips field removal.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 19, 2026

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add missing OpenAI/Claude/Gemini request fields' directly and accurately summarizes the main change across multiple files, adding new fields to request DTOs for these three AI providers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
relay/common/override_test.go (1)

778-813: Add tests for the core AllowIncludeObfuscation removal logic.

The new tests verify the pass-through skip paths, but there is no coverage for the actual include_obfuscation removal behaviour introduced in RemoveDisabledFields. The following scenarios are untested:

  1. include_obfuscation is stripped when AllowIncludeObfuscation = false
  2. include_obfuscation is preserved when AllowIncludeObfuscation = true
  3. stream_options is removed entirely when include_obfuscation was its only field (and AllowIncludeObfuscation = false)
  4. stream_options is kept (with its remaining fields) when other sibling fields (e.g. include_usage) co-exist
🧪 Proposed additional test cases
+func TestRemoveDisabledFieldsRemovesIncludeObfuscationByDefault(t *testing.T) {
+	input := `{"stream_options":{"include_usage":true,"include_obfuscation":false}}`
+	settings := dto.ChannelOtherSettings{} // AllowIncludeObfuscation = false by default
+
+	out, err := RemoveDisabledFields([]byte(input), settings, false)
+	if err != nil {
+		t.Fatalf("RemoveDisabledFields returned error: %v", err)
+	}
+	assertJSONEqual(t, `{"stream_options":{"include_usage":true}}`, string(out))
+}
+
+func TestRemoveDisabledFieldsRemovesStreamOptionsWhenOnlyIncludeObfuscation(t *testing.T) {
+	input := `{"model":"gpt-4","stream_options":{"include_obfuscation":false}}`
+	settings := dto.ChannelOtherSettings{}
+
+	out, err := RemoveDisabledFields([]byte(input), settings, false)
+	if err != nil {
+		t.Fatalf("RemoveDisabledFields returned error: %v", err)
+	}
+	assertJSONEqual(t, `{"model":"gpt-4"}`, string(out))
+}
+
+func TestRemoveDisabledFieldsPreservesIncludeObfuscationWhenAllowed(t *testing.T) {
+	input := `{"stream_options":{"include_usage":true,"include_obfuscation":false}}`
+	settings := dto.ChannelOtherSettings{AllowIncludeObfuscation: true}
+
+	out, err := RemoveDisabledFields([]byte(input), settings, false)
+	if err != nil {
+		t.Fatalf("RemoveDisabledFields returned error: %v", err)
+	}
+	assertJSONEqual(t, input, string(out))
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@relay/common/override_test.go` around lines 778 - 813, Add unit tests
covering RemoveDisabledFields's AllowIncludeObfuscation branch: write tests that
call RemoveDisabledFields with dto.ChannelOtherSettings{AllowIncludeObfuscation:
false} and payloads containing "stream_options":{"include_obfuscation":true} to
assert include_obfuscation is removed and stream_options is removed if it
becomes empty; another with AllowIncludeObfuscation: true to assert
include_obfuscation is preserved; and a test where stream_options contains
include_obfuscation plus another field (e.g. "include_usage") with
AllowIncludeObfuscation:false to assert include_obfuscation is stripped but
stream_options and the sibling field remain. Use function names like
TestRemoveDisabledFields_StripsIncludeObfuscation_WhenNotAllowed,
TestRemoveDisabledFields_PreservesIncludeObfuscation_WhenAllowed, and
TestRemoveDisabledFields_RemovesEmptyStreamOptions to locate coverage for
RemoveDisabledFields and dto.ChannelOtherSettings.
relay/common/relay_info.go (1)

739-752: Redundant map re-assignment on line 748.

streamOptions is the underlying map[string]interface{} obtained via type assertion from data["stream_options"]. Since Go maps are reference types, delete(streamOptions, "include_obfuscation") already mutates the map in-place, so data["stream_options"] already reflects the deletion without any explicit re-assignment.

♻️ Simplify the else branch
 			if len(streamOptions) == 0 {
 				delete(data, "stream_options")
-			} else {
-				data["stream_options"] = streamOptions
 			}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@relay/common/relay_info.go` around lines 739 - 752, The code redundantly
reassigns streamOptions back into data after mutating it; because maps are
reference types in Go, deleting a key via delete(streamOptions,
"include_obfuscation") already updates data["stream_options"]. Remove the
unnecessary else branch that sets data["stream_options"] = streamOptions and
instead only delete data["stream_options"] when streamOptions becomes empty;
keep the existing type-assertion and delete(streamOptions, ...) logic inside the
AllowIncludeObfuscation check.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@relay/common/override_test.go`:
- Around line 778-813: Add unit tests covering RemoveDisabledFields's
AllowIncludeObfuscation branch: write tests that call RemoveDisabledFields with
dto.ChannelOtherSettings{AllowIncludeObfuscation: false} and payloads containing
"stream_options":{"include_obfuscation":true} to assert include_obfuscation is
removed and stream_options is removed if it becomes empty; another with
AllowIncludeObfuscation: true to assert include_obfuscation is preserved; and a
test where stream_options contains include_obfuscation plus another field (e.g.
"include_usage") with AllowIncludeObfuscation:false to assert
include_obfuscation is stripped but stream_options and the sibling field remain.
Use function names like
TestRemoveDisabledFields_StripsIncludeObfuscation_WhenNotAllowed,
TestRemoveDisabledFields_PreservesIncludeObfuscation_WhenAllowed, and
TestRemoveDisabledFields_RemovesEmptyStreamOptions to locate coverage for
RemoveDisabledFields and dto.ChannelOtherSettings.

In `@relay/common/relay_info.go`:
- Around line 739-752: The code redundantly reassigns streamOptions back into
data after mutating it; because maps are reference types in Go, deleting a key
via delete(streamOptions, "include_obfuscation") already updates
data["stream_options"]. Remove the unnecessary else branch that sets
data["stream_options"] = streamOptions and instead only delete
data["stream_options"] when streamOptions becomes empty; keep the existing
type-assertion and delete(streamOptions, ...) logic inside the
AllowIncludeObfuscation check.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
relay/common/override_test.go (1)

778-846: Add coverage for allow_include_obfuscation passthrough.
You validate default removal and inference_geo, but not the “allowed” case for include_obfuscation. A small test will lock in the new behavior.

✅ Suggested test
+func TestRemoveDisabledFieldsAllowIncludeObfuscation(t *testing.T) {
+	input := `{
+		"stream_options":{"include_obfuscation":false},
+		"store":true
+	}`
+	settings := dto.ChannelOtherSettings{
+		AllowIncludeObfuscation: true,
+	}
+
+	out, err := RemoveDisabledFields([]byte(input), settings, false)
+	if err != nil {
+		t.Fatalf("RemoveDisabledFields returned error: %v", err)
+	}
+	assertJSONEqual(t, input, string(out))
+}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@relay/common/override_test.go` around lines 778 - 846, Add a unit test that
verifies include_obfuscation is preserved when
ChannelOtherSettings.AllowIncludeObfuscation is true: create a test (e.g.
TestRemoveDisabledFieldsAllowIncludeObfuscation) that calls RemoveDisabledFields
with input JSON containing "stream_options":{"include_obfuscation":false} (or
true) and settings := dto.ChannelOtherSettings{AllowIncludeObfuscation: true},
assert no error and that the output JSON still contains the
stream_options.include_obfuscation field using the existing assertJSONEqual
helper; reference RemoveDisabledFields and
dto.ChannelOtherSettings.AllowIncludeObfuscation to locate where to add the
test.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@relay/common/override_test.go`:
- Around line 778-846: Add a unit test that verifies include_obfuscation is
preserved when ChannelOtherSettings.AllowIncludeObfuscation is true: create a
test (e.g. TestRemoveDisabledFieldsAllowIncludeObfuscation) that calls
RemoveDisabledFields with input JSON containing
"stream_options":{"include_obfuscation":false} (or true) and settings :=
dto.ChannelOtherSettings{AllowIncludeObfuscation: true}, assert no error and
that the output JSON still contains the stream_options.include_obfuscation field
using the existing assertJSONEqual helper; reference RemoveDisabledFields and
dto.ChannelOtherSettings.AllowIncludeObfuscation to locate where to add the
test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant